﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

namespace Weibo2Sfdc
{
    public partial class WeiboEnquiryDetail : Form
    {
        public WeiboEnquiryDetail()
        {
            InitializeComponent();
        }

        public DataCenter DataCenter
        {
            get
            {
                return DataCenter.GetInstance();
            }
            set
            {
            }
        }

        public SyncEngine SyncEngine
        {
            get
            {
                return SyncEngine.GetInstance();
            }
            set
            {
            }
        }

        private void btn_close_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btn_sync_Click(object sender, EventArgs e)
        {
            try
            {
                prb_update.Minimum = 0;
                prb_update.Maximum = DataCenter.Beans.Count;
                prb_update.Value = DataCenter.Beans.Count/2;
                SyncEngine.StartSync();
                prb_update.Value = DataCenter.Beans.Count;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            MessageBox.Show("Sync Completed");
        }

        private void WeiboEnquiryDetail_Load(object sender, EventArgs e)
        {
            lst_detail.Items.Clear();
            foreach (WBContentBean b in DataCenter.Beans)
            {
                ListViewItem it = lst_detail.Items.Add(b.mid);
                it.SubItems.Add(b.content);
                it.SubItems.Add(b.item_date);
                it.SubItems.Add(b.from);
            }
            lbl_msg.Text = "" + lst_detail.Items.Count;
        }
    }
}
